var attributes = ['autocomplete="off"', 'autocorrect="off"', 'autocapitalize="off"', 'spellcheck="false"', 'contenteditable="true"'];
var attributesStr = attributes.join(" ");

hexo.extend.filter.register("after_post_render", function (data) {
    while (/<figure class="highlight ([a-zA-Z]+)">.*?<\/figure>/.test(data.content)) {
        data.content = data.content.replace(/<figure class="highlight ([a-zA-Z]+)">.*?<\/figure>/, function () {
            var language = RegExp.$1 || "plain";
            var lastMatch = RegExp.lastMatch;
            lastMatch = lastMatch.replace(/<figure class="highlight /, '<figure class="iseeu highlight ');
            lastMatch = lastMatch.replace(/<pre>/g,`<pre class="${language}">`)
            return '<div class="highlight-wrap" ' + attributesStr + ' data-rel="' + language.toUpperCase() + '">' + lastMatch + "</div>";
        });
    }
    return data;
});
